//
//  GHSAD_descTableViewCell.m
//  penzer
//
//  Created by 还带大道 on 2018/11/22.
//  Copyright © 2018年 caiyc. All rights reserved.
//

#import "GHSAD_descTableViewCell.h"

@interface GHSAD_descTableViewCell()
@property (weak, nonatomic) IBOutlet UIView *bgV;
@property (weak, nonatomic) IBOutlet UILabel *desc3;

@end
@implementation GHSAD_descTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    //设置阴影
    _bgV.backgroundColor = [UIColor whiteColor];
    _bgV.layer.shadowColor = RZ_COLOR_ALPHA(0, 0, 0, 0.1).CGColor;
    _bgV.layer.cornerRadius = 5;
    _bgV.layer.shadowOffset = CGSizeMake(0,4);
    _bgV.layer.shadowOpacity = 1;
    _bgV.layer.shadowRadius = 15;
}


- (void)setDesc3Str:(NSString *)desc3Str
{
    _desc3Str = desc3Str;
    if(desc3Str && desc3Str.length>0){
        NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];
        paragraph.lineSpacing = 3; //设置行间距
        paragraph.alignment = NSTextAlignmentLeft;
        NSDictionary *attributeDict = @{
                                        NSFontAttributeName:[UIFont systemFontOfSize:12],
                                        NSForegroundColorAttributeName:_desc3TextColor,
                                        NSKernAttributeName:@0,//字符间距
                                        NSParagraphStyleAttributeName:paragraph};
        
        NSMutableAttributedString *attributeStr = [[NSMutableAttributedString alloc] initWithString:desc3Str attributes:attributeDict];
        _desc3.attributedText = attributeStr;
    }
}



- (void)layoutSubviews
{
    [super layoutSubviews];
    [_desc3 sizeToFit];
    _cellH = 145 + _desc3.height;
}


- (CGFloat)cellH
{
    [self layoutIfNeeded];
    self.bgV.layer.shadowPath = [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, self.bgV.width, _cellH-12)].CGPath;
    return _cellH;
}

@end
